package gw.demo2.service;

import gw.demo2.entity.PurchaseRecord;
import gw.demo2.mapper.PurchaseRecordMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

@Service
public class PurchaseRecordService {
    @Autowired
    private PurchaseRecordMapper purchaseRecordMapper;

    public boolean addPurchaseRecord(PurchaseRecord record) {
        return purchaseRecordMapper.insertPurchaseRecord(record) > 0;
    }

    public List<PurchaseRecord> getPurchaseRecordsByUserId(int userId) {
        return purchaseRecordMapper.selectPurchaseRecordsByUserId(userId);
    }
}